package com.xp.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xp.common.JsonObject;
import com.xtkj.service.IUserService;
import com.xp.vo.User;
@Controller
public class UserController {
	@Autowired
	private IUserService userService;
	
	@RequestMapping("/users")
	@ResponseBody
	public JsonObject<PageInfo<User>> getUser(Integer pageNumber,Integer pageSize){
		PageHelper.startPage(pageNumber, pageSize,"user_id desc");
		List<User> list = userService.getUsers();
		PageInfo<User> p = new PageInfo<User>(list) ;
		JsonObject<PageInfo<User>> json = new JsonObject<PageInfo<User>>("ok",200,p);
		return json;
	}
	
}
